package org.lq.ht.util;

import java.awt.Panel;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
/**
 * 弹窗提示和弹窗输入工具类
 *@author 黄明慧
 * @package org.lq.ht.util
 * @date 2020年8月23日上午9:56:14
 */
public class ShowMessage {
	/**
	 * 窗体的弹窗提示
	 * @param jf
	 * @param bool
	 * @param message
	 */
	public static void frameMessage(JFrame jf ,boolean bool,String message) {
		if(bool) {
			JOptionPane.showMessageDialog(jf,message,"正确",JOptionPane.INFORMATION_MESSAGE );
			
		}else {
			JOptionPane.showMessageDialog(jf,message,"错误",JOptionPane.ERROR_MESSAGE );
		}
	}
	/**
	 * 容器JPanel的弹窗提示
	 * @param panel
	 * @param bool
	 * @param message
	 */
	public static void panelMessage(JPanel panel ,boolean bool,String message) {
		if(bool) {
			JOptionPane.showMessageDialog(panel,message,"正确",JOptionPane.INFORMATION_MESSAGE );
			
		}else {
			JOptionPane.showMessageDialog(panel,message,"错误",JOptionPane.ERROR_MESSAGE );
		}
	}
	/**
	 * 窗体的弹窗输入
	 * @param jf
	 * @return
	 */
	public static  int windowsConfirm(JFrame jf) {
		int num = JOptionPane.showConfirmDialog(jf, "你确定要删除吗","删除",JOptionPane.OK_CANCEL_OPTION);
		return num;
	}
	/**
	 * 容器的弹窗输入
	 * @param panel
	 * @return
	 */
	public static int windowsConfirm(JPanel panel) {
		int num = JOptionPane.showConfirmDialog(panel, "你确定要删除吗","删除",JOptionPane.OK_CANCEL_OPTION);
		return num;
	}
}
